import type { Provider, Model } from "./AiCore";

import pngAlibailian from "../assets/providers/alibailian.png";
import pngDeepSeek from "../assets/providers/deepseek.png";
import pngDoubao from "../assets/providers/doubao.png";
import pngMoonshot from "../assets/providers/moonshot.png";
import pngZhipu from "../assets/providers/zhipu.png";

// 供应商图标映射
export const PROVIDER_ICONS: Record<string, string> = {
	deepseek: pngDeepSeek,
	moonshot: pngMoonshot,
	alibailian: pngAlibailian,
	doubao: pngDoubao,
	zhipu: pngZhipu,
};

// 基于最新联网数据生成的大模型和供应商配置
export const AI_PROVIDERS: Provider[] = [
	// DeepSeek 供应商
	{
		id: "deepseek",
		name: "DeepSeek",
		apiKey: "",
		apiHost: "https://api.deepseek.com",
		models: [
			{
				id: "deepseek-chat",
				provider: "deepseek",
				name: "DeepSeek Chat",
				group: "DeepSeek",
				description: "DeepSeek通用对话模型，基于V3架构，支持通用对话和文本生成",
				type: ["text", "function_calling"],
			},
			{
				id: "deepseek-reasoner",
				provider: "deepseek",
				name: "DeepSeek R1",
				group: "DeepSeek",
				description:
					"DeepSeek推理模型R1-0528版本，在数学、编程和逻辑推理方面表现卓越，AIME 2025测试准确率87.5%",
				type: ["reasoning", "text", "function_calling"],
			},
		],
		enabled: false,
		isSystem: false,
		rateLimit: 100,
		notes:
			"DeepSeek R1-0528版本在复杂推理任务中表现优异，API定价：输入1-4元/百万tokens，输出16元/百万tokens",
	},

	// Moonshot AI (Kimi) 供应商
	{
		id: "moonshot",
		name: "Moonshot AI",
		apiKey: "",
		apiHost: "https://api.moonshot.cn/v1",
		models: [
			{
				id: "kimi-latest",
				provider: "moonshot",
				name: "Kimi Latest",
				group: "Kimi",
				description:
					"Kimi最新版本，支持200万字超长上下文，在长文本理解和处理方面表现突出",
				type: ["text", "vision"],
			},
			{
				id: "kimi-k1.5",
				provider: "moonshot",
				name: "Kimi K1.5",
				group: "Kimi",
				description:
					"Kimi K1.5版本，优化了推理能力和代码生成，在多项基准测试中表现优异",
				type: ["reasoning", "text", "function_calling"],
			},
			{
				id: "kimi-k1.6",
				provider: "moonshot",
				name: "Kimi K1.6",
				group: "Kimi",
				description: "Kimi K1.6最新版本，进一步提升推理能力和工具调用能力",
				type: ["reasoning", "text", "function_calling", "vision"],
			},
		],
		enabled: false,
		isSystem: false,
		rateLimit: 100,
		notes:
			"Kimi系列以超长上下文能力著称，支持200万字上下文，适合长文档处理和分析",
	},

	// 阿里云百炼 (通义千问) 供应商
	{
		id: "alibailian",
		name: "阿里云百炼",
		apiKey: "",
		apiHost: "https://dashscope.aliyuncs.com/compatible-mode/v1",
		apiVersion: "v1",
		models: [
			{
				id: "qwen-max",
				provider: "alibailian",
				name: "通义千问-Max",
				group: "Qwen",
				description:
					"通义千问旗舰模型Qwen2.5-Max，预训练数据超过20万亿tokens，在数学和编程能力上表现优异",
				type: ["text", "reasoning", "function_calling", "vision"],
			},
			{
				id: "qwen-plus",
				provider: "alibailian",
				name: "通义千问-Plus",
				group: "Qwen",
				description: "通义千问Plus版本，平衡性能和成本，适合大多数应用场景",
				type: ["text", "vision", "function_calling"],
			},
			{
				id: "qwen-turbo",
				provider: "alibailian",
				name: "通义千问-Turbo",
				group: "Qwen",
				description:
					"通义千问Turbo版本，高性价比选择，输入价格降至0.3元/百万tokens",
				type: ["text"],
			},
			{
				id: "qwen-coder-latest",
				provider: "alibailian",
				name: "通义千问-Coder",
				group: "Qwen",
				description:
					"通义千问代码大模型Qwen3-Coder，4800亿参数MoE架构，在代码生成和编程任务上超越GPT-4.1",
				type: ["text", "function_calling", "reasoning"],
			},
			{
				id: "qwen-vl-max",
				provider: "alibailian",
				name: "通义千问-VL-Max",
				group: "Qwen",
				description:
					"通义千问视觉理解模型，支持图像理解和分析，价格降至0.003元/千tokens",
				type: ["vision", "text"],
			},
		],
		enabled: false,
		isSystem: false,
		rateLimit: 200,
		notes:
			"阿里云百炼平台提供全系列通义千问模型，价格持续降低，Qwen-Max性能接近GPT-4o",
	},

	// 字节豆包 供应商
	{
		id: "doubao",
		name: "字节豆包",
		apiKey: "",
		apiHost: "https://ark.cn-beijing.volces.com/api/v3/",
		models: [
			{
				id: "doubao-pro-32k",
				provider: "doubao",
				name: "豆包-Pro-32K",
				group: "Doubao",
				description:
					"豆包主力模型Pro版本，支持32K上下文，综合能力对标GPT-4o，价格仅为GPT-4o的八分之一",
				type: ["text", "reasoning", "function_calling"],
			},
			{
				id: "doubao-lite-32k",
				provider: "doubao",
				name: "豆包-Lite-32K",
				group: "Doubao",
				description: "豆包轻量模型Lite版本，高性价比选择，适合日常使用",
				type: ["text"],
			},
			{
				id: "doubao-pro-128k",
				provider: "doubao",
				name: "豆包-Pro-128K",
				group: "Doubao",
				description: "豆包Pro版本，支持128K长上下文，适合处理长文档",
				type: ["text", "reasoning"],
			},
			{
				id: "doubao-character",
				provider: "doubao",
				name: "豆包-角色扮演",
				group: "Doubao",
				description: "豆包角色扮演专用模型，优化了角色对话和个性化交互",
				type: ["text"],
			},
		],
		enabled: false,
		isSystem: false,
		rateLimit: 300,
		notes:
			"字节豆包大模型，价格极具竞争力，主力模型0.0008元/千Tokens，比行业便宜99.3%",
	},

	// 智普AI 供应商
	{
		id: "zhipu",
		name: "智普AI",
		apiKey: "",
		apiHost: "https://open.bigmodel.cn/api/paas/v4/",
		models: [
			{
				id: "glm-4.5",
				provider: "zhipu",
				name: "GLM-4.5",
				group: "GLM",
				description:
					"智普新一代旗舰模型GLM-4.5，3550亿参数MoE架构，推理、编码与智能体能力原生融合，开源模型SOTA水平",
				type: ["text", "reasoning", "function_calling"],
			},
			{
				id: "glm-4.5-air",
				provider: "zhipu",
				name: "GLM-4.5-Air",
				group: "GLM",
				description: "GLM-4.5轻量版本，1060亿参数，保持高性能的同时提升效率",
				type: ["text", "reasoning", "function_calling"],
			},
			{
				id: "glm-z1",
				provider: "zhipu",
				name: "GLM-Z1",
				group: "GLM",
				description: "智普推理专用模型GLM-Z1，优化了复杂推理和逻辑分析能力",
				type: ["reasoning", "text"],
			},
			{
				id: "codegeex-4",
				provider: "zhipu",
				name: "CodeGeeX-4",
				group: "GLM",
				description: "智普代码生成模型CodeGeeX-4，专为编程和代码理解任务优化",
				type: ["text", "function_calling", "reasoning"],
			},
			{
				id: "glm-4-air",
				provider: "zhipu",
				name: "GLM-4-Air",
				group: "GLM",
				description: "GLM-4高效版本，平衡性能和响应速度",
				type: ["text"],
			},
		],
		enabled: false,
		isSystem: false,
		rateLimit: 150,
		notes:
			"智普GLM-4.5系列，API定价：输入0.8元/百万tokens，输出2元/百万tokens，高速版100tokens/秒",
	},
];

// 按性能排序的推荐模型列表
export const RECOMMENDED_MODELS: Model[] = [
	// 推理能力最强
	{ ...AI_PROVIDERS[0].models[1] }, // DeepSeek R1
	{ ...AI_PROVIDERS[4].models[0] }, // GLM-4.5
	{ ...AI_PROVIDERS[1].models[2] }, // Kimi K1.6

	// 通用对话最佳
	{ ...AI_PROVIDERS[0].models[0] }, // DeepSeek Chat
	{ ...AI_PROVIDERS[2].models[0] }, // Qwen-Max
	{ ...AI_PROVIDERS[3].models[0] }, // Doubao-Pro

	// 代码生成专用
	{ ...AI_PROVIDERS[2].models[3] }, // Qwen-Coder
	{ ...AI_PROVIDERS[4].models[2] }, // CodeGeeX-4

	// 视觉理解
	{ ...AI_PROVIDERS[2].models[4] }, // Qwen-VL-Max

	// 长文本处理
	{ ...AI_PROVIDERS[1].models[0] }, // Kimi Latest
	{ ...AI_PROVIDERS[3].models[2] }, // Doubao-Pro-128K
];

// 按价格排序的经济型模型
export const BUDGET_MODELS: Model[] = [
	{ ...AI_PROVIDERS[3].models[1] }, // Doubao-Lite
	{ ...AI_PROVIDERS[2].models[2] }, // Qwen-Turbo
	{ ...AI_PROVIDERS[4].models[4] }, // GLM-4-Air
];

// 导出所有模型列表
export const ALL_MODELS: Model[] = AI_PROVIDERS.flatMap(
	(provider) => provider.models
);
